package com.gy.hsim.bservice.framework.db;


import java.sql.Connection;
import java.sql.SQLException;

import com.alibaba.druid.pool.DruidDataSource;
import com.gy.hsim.bservice.framework.spring.SpringUtil;

public class ConnectionFactory {
	private static DruidDataSource ds=(DruidDataSource)SpringUtil.getBean("dataSource");
	
	private ConnectionFactory(){
		
	}
	
	public static synchronized Connection getConnection(){
		Connection con = null;
		try {
			con=ds.getConnection();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return con;
	}
	
	public static void close(){
		ds.close();
	}
	
}
